<?php
/**
 * JoiGallery - image gallery component for Joostina
 *
 * Менеджер дополнительных полей
 *
 * @version 1.0 alpha 12
 * @package JoiGallery
 * @subpackage	AdminView
 * @filename extrafield_list.php
 * @author JoostinaTeam
 * @copyright (C) 2008-2009 Joostina Team
 * @license see license.txt
 *
 **/
 
defined('_VALID_MOS') or die();

?>

<table class="adminheading">
  <tr>
    <th class="config">
     <?php echo _C_JOIGALLERY_COMPONENT;
           echo _C_JOIGALLERY_EXTRAFIELDS;
      ?>
    </th>
  </tr>
</table>

<form action="index2.php" method="post" name="adminForm" id="adminForm">
  
  <table class="adminlist" width="100%">
    <tr>
      <th width="30">ID</th>
      <th width="20">
        <input type="checkbox" name="toggle" value="" onClick="checkAll(<?php echo count( $extrafield_list );?>);" />
      </th>
      <th>Поле</th>
      <th>Тип</th>
      <th>Подпись</th>
      <th>Обязательное</th>
      <th>Опубликовано</th>
    </tr>

  <?php
  $i = 0;
  foreach($extrafield_list as $field){
    $link = 'index2.php?option='.$option.'&act=extrafields&task=extrafield&cid='.$field->id;
    $field_name = '<a href="'.$link.'">'.$field->name.'</a>';
        $img = $field->published ? 'publish_g.png' : 'publish_x.png';
        ?>
    <tr>
      <td align="right"><?php echo $field->id; ?></td>
      <td align="center"><?php echo mosHTML::idBox($i, $field->id); ?></td>
      <td><?php echo $field_name; ?></td>
      <td> <?php echo $field->type; ?> </td>
      <td> <?php echo $field->label; ?> </td>
      <td align="center"><?php echo ( $field->required ? _YES : _NO ); ?></td>

      <td align="center">
        <a href="javascript:void(0);" onclick="return listItemTask('cb<?php echo $i;?>','<?php echo $field->published ? 'unpublish' : 'publish'; ?>')">
          <img alt="" src="images/<?php echo $field->published ? "tick.png" : "publish_x.png"; ?>" border="0" />
        </a>
      </td>

    </tr>
  <?php $i++; } ?>

  </table>

  <input type="hidden" name="option" value="<?php echo $option; ?>" />
  <input type="hidden" name="act" value="extrafields" />
  <input type="hidden" name="task" value="" />
  <input type="hidden" name="<?php echo josSpoofValue(); ?>" value="1" />
  <input type="hidden" name="boxchecked" value="0" />
  
</form>